package m.jclecai.com.utils;

import java.util.HashMap;

import m.jclecai.com.bean.Bonusbean;

/**
 * 这里是用来辅助计算盈利追号的奖金的；
 */

public class BonusUtil {
    private static HashMap<String, Bonusbean> tbonus = new HashMap<String, Bonusbean>();// 奖金列表


    public static final class CastType{
        //JAVA
        public static final String CASTTYPE_SINGLE = "1"; // 单式
        public static final String CASTTYPE_MULTI = "2"; // 复式
        public static final String CASTTYPE_BAOHAO = "3"; // 包号
        public static final String CASTTYPE_HESHU = "4"; // 和值
        public static final String CASTTYPE_DANTUO = "5"; // 胆拖

        //php 版本1，3，4，5，没有2
    }
    public static final class GameType {



        public static final String SD = "1";
        public static final String PLs = "2";
        public static final String CQSSC = "3";
        public static final String JXSSC = "5";


        public static final String SDSYXW = "8";
        public static final String SYXW = "9";
        public static final String GDSYXW = "10";
        public static final String PLW = "13";

        public static final String SSQ = "16";
        public static final String QLC = "17";
        public static final String QXC = "18";
        public static final String DLT = "19";

        public static final String AHK3 = "32";
        public static final String HBK3 = "33";
        public static final String JLK3 = "34";
        public static final String JSK3 = "35";

    }

    public static final class GameContains{

        //重庆时时彩

        public static final String SSC_1XZX="1";
        public static final String SSC_2XZX="2";  //二星直选
        public static final String SSC_2XZXHZ="2";//二星直选和值
        public static final String SSC_3XZX="3";
        public static final String SSC_5XZX="5";
        public static final String SSC_2XZ2="10";  //二星组选
        public static final String SSC_2XTXHZ="10";//二星组选和值
        public static final String SSC_DXDS="11";
        public static final String SSC_5XTX="12";
        public static final String SSC_3XZ3="15";
        public static final String SSC_3XZ6="16";
        //十一选五
        public static final String SYXW_R1="1";
        public static final String SYXW_R2="2";
        public static final String SYXW_R3="3";
        public static final String SYXW_R4="4";
        public static final String SYXW_R5="5";
        public static final String SYXW_R6="6";
        public static final String SYXW_R7="7";
        public static final String SYXW_R8="8";
        public static final String SYXW_Q2="9";
        public static final String SYXW_Q3="10";
        public static final String SYXW_Z2="11";
        public static final String SYXW_Z3="12";

        //快3
        public static final String K3_HZ="1";//和值
        public static final String K3_3A="2";//三同号通选
        public static final String K3_3B="3";//三同号单选
        public static final String K3_3C="4";//三不同号
        public static final String K3_3D="5";//三连号通选
        public static final String K3_2A="6";//二同号复选
        public static final String K3_2B="7";//二同号单选
        public static final String K3_2C="8";//二不同号
        public static final String K3_XT="9";//大小单双

    }

    static {


        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R1, "任选一", 13.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R2, "任选二", 6.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R3, "任选三", 19.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R4, "任选四", 78.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R5, "任选五", 540.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R6, "任选六", 90.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R7, "任选七", 26.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_R8, "任选八", 9.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_Q2, "前二直选", 130.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_Q3, "前三直选", 1170.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_Z2, "前二组选", 65.00));
        putMethod(new Bonusbean(GameType.SDSYXW,GameContains.SYXW_Z3, "前三组选", 195.00));

        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_1XZX, "一星直选", 10.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_2XZX, "二星直选", 100.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_2XZXHZ, "二星直选和值", 100.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_3XZX, "三星直选", 100.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_5XZX, "五星直选", 100000.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_2XZ2, "二星组选", 50.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_2XTXHZ, "二星组选和值", 50.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_DXDS, "大小单双", 4.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_5XTX, "五星通选", 20.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_3XZ3, "三星组三", 320.00));
        putMethod(new Bonusbean(GameType.CQSSC,GameContains.SSC_3XZ6, "三星组六", 160.00));


        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_HZ, "和值", 9.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_3A, "三同号通选", 40.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_3B, "三同号单选", 240.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_3C, "三不同号", 40.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_3D, "三连号通选", 10.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_2A, "二同号复选", 15.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_2B, "二同号单选", 80.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_2C, "二不同号", 8.00));
        putMethod(new Bonusbean(GameType.JSK3,GameContains.K3_XT, "大小单双", 0.00));


    }

    private static void putMethod(Bonusbean bonusbean) {
        String key = bonusbean.getGameId()+"_"+bonusbean.getMethodId();
        tbonus.put(key, bonusbean);

    }

    public static boolean isSYXW(String key) {
        String[] data = {"8", "9", "10", "24", "25", "26", "27", "28"};

        return  fore(data,key);
    }

    public static boolean isK3(String key) {
        String[] data = {"32", "33", "34", "35"};

        return  fore(data,key);
    }

    public static boolean fore(String[] data,String key){
        for (String s : data) {
            if(s.equals(key)){
                return true;
            }
        }
        return false;
    }

    public static boolean isSSC(String key) {
        String[] data = {"3", "5"};

        return  fore(data,key);
    }

    public static double getlotBonus(String key,String methodId){
        double b = 0.00;
        String k  = key+"_"+methodId;
        if(isSYXW(key)){
            k = GameType.SDSYXW+"_"+methodId;
        }else if(isSSC(key)){
            k = GameType.CQSSC+"_"+methodId;
        }else if(isK3(key)){
            k = GameType.JSK3+"_"+methodId;
        }

        b = tbonus.get(k).getBonus();


        return b;
    }

}
